<template>
  <div class="School_boxs">
    <navconH5 style="background-color: #fff" />
    <div class="example-search" style="background-color: #fff; padding: 10px">
      <t-search placeholder="学校搜索" v-model="formInline.school_name" @blur="onSearchs" @clear="onSearchs"></t-search>
    </div>
    <TreeTable ref="Trees" :menuList="getAllList" @selseTab="selseTab" :badgeObjs="badgeObjs" :selse="selse"
      :isEnd="isends" @handleScroll="handleScroll">
      <template #solt1>
        <!-- <el-button size="small" plain @click="resttye">
          <el-icon style="margin-right: 2px"><Delete /></el-icon>
          重新核校</el-button
        > -->
        <div v-if="selse != 13">
          <div class="top_shows" v-if="!manage">
            <div>
              <el-button size="small" type="success" plain @click="addshool" v-if="
                (selse == 2 && authority([2])) ||
                (authority([3]) && selse == 9)
              "><el-icon style="margin-right: 2px">
                  <CirclePlus />
                </el-icon>
                添加</el-button>

              <el-button size="small" type="success" plain @click="screen"><el-icon style="margin-right: 2px">
                  <Filter />
                </el-icon>
                筛选</el-button>
              <el-button size="small" plain @click="manageMag"
                v-if="selse != 1 && !is_online() && authority([2])"><el-icon style="margin-right: 2px">
                  <Star />
                </el-icon>
                管理</el-button>
              <!-- 在地工作人员的筛选 -->
              <el-button size="small" plain @click="manageMag" v-if="
                (selse != 1 &&
                  authority([4]) &&
                  (selse == 2 || selse == 5 || selse == 11)) ||
                ((selse == 7 || selse == 9) && (authority([3]) || (user && user.is_qstatus == 2)))
              "><el-icon style="margin-right: 2px">
                  <Star />
                </el-icon>
                管理</el-button>
            </div>
          </div>

          <div v-if="manage">
            <div    class="top_shows" style="display: flex;justify-content: end;">
              <el-button size="small" type="primary" plain @click="manageMag" text >
                <el-icon style="margin-right: 2px"><Close /></el-icon>
                关闭管理</el-button
              > 
            </div>
            <div class="top_shows" style="
                display: flex;
                justify-content: space-between;
                align-items: center;
              ">
              <div>
                <!-- 全选按钮 -->
                <t-checkbox v-model="selectAll" @click="handleSelectAllClick" @change="handleSelectAll"
                  style="font-size: 14px; padding: 0; color: #49b9ad" />
              </div>
              <div>
                <el-button size="small" type="success" plain @click="openOkAll(null, '核校', 2)"
                  v-if="selse == 2 && authority([4])">
                  核校</el-button>
                <el-button size="small" type="success" plain @click="openOkAll(null, '排课', 4)"
                  v-if="selse == 3 && authority([2])">
                  排课</el-button>
                <el-button size="small" type="danger" plain @click="openOkAll(null, '驳回', 3)"
                  v-if="selse == 3 && authority([2])">
                  驳回</el-button>
                <el-button size="small" type="success" plain @click="openOkAll(null, '重新核校', 1)"
                  v-if="selse == 5 && authority([2, 4])">
                  重新核校</el-button>
                <el-button size="small" type="danger" plain @click="handleDelete" v-if="
                  selse != 1 &&
                  (authority([2]) || (authority([3]) || (user && user.is_qstatus == 2)))
                ">
                  删除</el-button>
                <!-- 线上负责人排课 -->
                <el-button size="small" type="success" plain @click="openOkAll(null, '排课', null)"
                  v-if="selse == 7 && authority([3])">
                  排课</el-button>
                <el-button v-if="authority([4]) && selse == 11" size="small" plain style="margin-left: 3px;"
                  @click="handleOut">
                  外出</el-button>
                <!-- <el-button size="small" type="info" plain @click="manageMag">
                  关闭</el-button> -->
              </div>
            </div>
          </div>
        </div>
      </template>

      <template #solt2>
        <el-empty description="暂无数据" v-if="!tableData.length" />
        <div v-else>
          <div v-for="(item, index) in tableData" :key="index" class="tablistShows">
            <t-swipe-cell ref="cell1">
              <!-- 多选选择处 -->
              <!-- 督课 -->
              <onlineView v-if="is_online()" :listobjs="item" @inspect="inspect" ref="showViewList"
                :is_waichu="authority([4]) && selse == 11 && item.is_waichu == 2" :scheck="manage" :selectArr="selectAll">
                <template #booton>
                  <div style="
                      display: flex;
                      justify-content: end;
                      align-items: center;
                      padding-top: 5px; 
                    " v-if="!manage">
                    <el-button v-if="(authority([3]) || user.is_qstatus == 2) && selse == 9" size="small" type="success"
                      plain @click.stop="dikshow(item)" style="margin-left: 3px;">
                      转代课</el-button>
                    <el-button v-if="(authority([3]) || user.is_qstatus == 2) && selse == 9" size="small" type="success"
                      plain @click.stop="dukshow(item)" style="margin-left: 3px;">
                      转督课</el-button>
                    <el-button v-if="(authority([3]) || user.is_qstatus == 2) && selse == 9" size="small" type="success"
                      plain style="margin-left: 3px;" @click.stop="editShools(item)">
                      编辑</el-button>
                    <el-button size="small" type="danger" plain style="margin-left: 3px;"
                      @click.stop="handleDelete(item)" v-if="(authority([3]) || user.is_qstatus == 2) && selse == 9">
                      删除</el-button>

                    <el-button v-if="authority([5]) && (selse == 12||15)" size="small" type="success" plain
                      style="margin-left: 3px;" @click.stop="editShools(item)">
                      {{selse==12?'督课信息填写':'代课信息填写'}}</el-button>

                    <el-button v-if="authority([4]) && selse == 11" size="small" type="success" plain
                      style="margin-left: 3px;" @click.stop="editShools(item)">
                      在地编辑</el-button>
                    <el-button v-if="authority([4]) && selse == 11 && item.is_waichu == 1" size="small" plain
                      style="margin-left: 3px;" @click.stop="handleOut(item)">
                      外出</el-button>
                    <span v-if="authority([4]) && selse == 11 && item.is_waichu == 2"
                      style="color:red;font-size: 12px;margin-left: 10px;">当前外出</span>
                  </div>
                </template>
              </onlineView>
              <!-- 学校 -->
              <showView v-if="!is_online() && selse != 13" :listobjs="item" @inspect="inspect" ref="showViewList"
                :scheck="manage" :selectArr="selectAll">
                <template #booton v-if="!manage && selse != 1 && selse != 13">
                  <div style="
                      display: flex;
                      justify-content: end;
                      padding-top: 5px;
                    ">
                    <el-button v-if="authority([4]) && selse == 2" size="small" type="success" plain
                      @click.stop="editShoolshx(item)">
                      核校确认</el-button>
                    <el-button v-if="
                      (authority([2]) && (selse == 2 || selse == 6)) ||
                      (authority([4]) && selse == 6)
                    " size="small" type="success" plain @click.stop="editShools(item)"><el-icon
                        style="margin-right: 2px">
                        <Edit />
                      </el-icon>
                      编辑</el-button>
                    <el-button size="small" type="success" plain @click.stop="openOkAll(item, '排课', 4)"
                      v-if="selse == 3 && authority([2])">
                      排课</el-button>
                    <el-button size="small" type="success" plain @click.stop="openOkAll(item, '排课', null)"
                      v-if="selse == 7 && authority([3])">
                      排课</el-button>
                    <el-button size="small" type="danger" plain @click.stop="openOkAll(item, '驳回', 3)"
                      v-if="selse == 3 && authority([2])">
                      驳回</el-button>
                    <el-button size="small" type="success" plain @click.stop="openOkAll(item, '重新核校', 1)"
                      v-if="selse == 5 && authority([2, 4])">
                      重新核校</el-button>

                    <!-- <el-button size="small" type="danger" plain @click.stop="handlewent(item)"
                      v-if="authority([2]) && (selse == 3 || selse == 2)">
                      问题校</el-button> -->
                    <el-button size="small" type="danger" plain @click.stop="handleDelete(item)"
                      v-if="authority([2])"><el-icon style="margin-right: 2px">
                        <Delete />
                      </el-icon>
                      删除</el-button>
                  </div>
                </template>
              </showView>
              <facility :listobjs="item" v-if="!is_online() && selse == 13" @inspect="inspect" ref="showViewList"
                :scheck="manage" :selectArr="selectAll" />
            </t-swipe-cell>
          </div>
        </div>
      </template>
    </TreeTable>
    <!-- 筛选 -->
    <H5SchoolScreem v-if="!is_online()" ref="SchoolScreem" :hexsho="authority([1,2,3,4]) && selse == 1" @submitForm="submitForm"
      @resetscreem="resetscreem" />
    <H5OnlineScreem v-else ref="SchoolScreem" @submitForm="submitForm" @resetscreem="resetscreem" :is_daiks=" selse != 14" />
    <!-- 学校新增 -->
    <AddShool v-if="!is_online()" ref="AddShool_rows" @addForm="addForm" @endForm="endForm"></AddShool>
    <AddOnline v-if="is_online() && (selse != 12 || selse != 11||selse != 14)" ref="AddShool_rows" @addForm="addForm"
      @endForm="endForm">
    </AddOnline>
    <!-- 督课信息 -->
    <addonlinexx v-if="selse == 12 || selse == 11||selse == 14" @endForm="endForm" :daiktx="selse == 14" ref="AddShool_rows"></addonlinexx>
    <dikzj ref="dikzjs" @endForm="TodikendForm" />
    <dukzj ref="dukzjs" @endForm="TodukendForm" />
  </div>
</template>

<script setup>
import H5SchoolScreem from "@/components/h5com/h5_school_screem.vue";
import H5OnlineScreem from "@/components/h5com/h5_online_screem.vue";
import dikzj from "@/components/h5com/shool/zjdk.vue"; //转交代课
import dukzj from "@/components/h5com/shool/zjduk.vue"; //转交督课
import addonlinexx from "@/components/h5com/shool/addonlinexx.vue"; //转交督课
import facility from "@/components/h5com/facility.vue"
import AddShool from "@/components/h5com/shool/addSchool.vue";
import AddOnline from "@/components/h5com/shool/addOnline.vue";

import navconH5 from "@/components/navconH5.vue";
import TreeTable from "@/components/h5com/treeTable.vue";
import showView from "@/components/h5com/shoolView.vue";
import onlineView from "@/components/h5com/onlineView.vue";
import { nextTick, ref, inject } from "vue";
import { ElMessageBox } from "element-plus";

import { setStorage, getStorage } from "@/utils/util";
import {
  statuss, //核校状态改变
  caicount,
  schoolList,
  schoolAdd,
  schoolDel,
  schoolUpdate,
  scheduling,
  updatedaike,
  updateduke,
  schewaichu
} from "@/api/api";
import {
  timetableList, timetableDel, timetableAdd,
  timetableUpdate
} from "@/api/api";
import { Message } from "tdesign-mobile-vue";
import { round } from "xe-utils";
import { useRoute } from "vue-router";
const route = useRoute();
const wentixs = ref(false);

const onlineArrid = ref([9, 10, 11, 12,14]);//督课表
const $dialog = inject("$dialog");
let allmenu = ref([]);
let menuTitle = ref("");
let sholID = ref("5"); //学校管理栏目页面id
let selse = ref(); //当前选择的id
let tabobjs = ref({}); //当前选择的数据对象
const getAllList = ref([]);
let badgeObjs = ref({});
const tableData = ref([]); //基础列表数据获取
const SchoolScreem = ref(null); //学校筛选
const formInline = ref({ page: 1, per_page: 10 }); //数据引用分页
const Twostab = ref({ page: 1, per_page: 10, total: 0 }); //重置数据分页
const Trees = ref(null);
const selectAll = ref(false); //全选是否显示
const manage = ref(false); //管理展示
const showViewList = ref(null); //列表数据
const AddShool_rows = ref(null); //学校新增
const dikzjs = ref(null);
const dukzjs = ref(null);
const ids = ref([]); //ids 获取 
// selse.value=route
const manageMag = () => {
  // 管理变化
  manage.value = !manage.value;
  if (!manage.value) {
    hidesele(); //全选关闭
  }
};
const hidesele = () => {
  ids.value = [];
  selectAll.value = false;
  manage.value = false;
  handleSelectAllClick(); //全选关闭
};
const dukshow = (row) => {

  dukzjs.value.editupdata(row); //数据编辑
}

const dikshow = (row) => {

  dikzjs.value.editupdata(row); //数据编辑
}

function getMenu() {
  menuTitle.value = "";
  allmenu.value = [];
  //动态加载菜单
  allmenu.value = JSON.parse(getStorage("allmenu"));
  let menu = allmenu.value.find((item) => item.id == sholID.value);
  rests(); //数据资源重置

  getAllList.value = menu.children; //获取当前菜单下的子菜单
  if (route.query.id) selseTab(route.query.id, route.query.id!=13? true:false,true);
  else selseTab(getAllList.value[0].id); //默认选中第一个
}
const isends = ref(false);
const user = ref(null);//当前用户信息
const userInfo = ref(Number(JSON.parse(getStorage("groupId")))); //权限
const authority = (groupArr = [0]) => {
  // 权限筛选
  let userInfos = userInfo.value;
  // 当前权限和传来的权限组进行对比
  if (groupArr.some((item) => Number(item) === userInfos)) return true;
  return false;
};
// 是否督课状态
const is_online = () => {
  // 是否督课状态
  if (onlineArrid.value.some((item) => Number(item) == selse.value)) {
    return true;
  }
  return false;
};
function caicountOpen() {
  // 角标数据获取
  caicount().then((res) => {
    if (res.code === 1) {
      badgeObjs.value = res.data;
      let objs = {};
      for (let key in res.data) {
        if (typeof res.data[key] == "object") objs[key] = res.data[key];
      }
      console.log(objs);
      setStorage("courseObj", JSON.stringify(objs));
    }
  });
}
function onSearchs() {
  console.log("搜索---------1", formInline.value.school_name);
  let vaObj={};
  vaObj.school_name=formInline.value.school_name;
  rests(); //数据资源重置
  formInline.value = { ...formInline.value, ...vaObj };
  getdata();
}
function selseTab(id,getone=false,s=false) {
  // 基础数据获取都在这边

  if (id != selse.value) {
   
    // 点击左侧table 切换右侧tableselseTab
    selse.value = id;
    // isends.value = false;
    tabobjs.value = getAllList.value.find((item) => item.id == id); //获取当前数据基础资源
    rests(); //数据资源重置
    caicountOpen(); // 获取badge数据
    // 一开始的话就不加载数据了 因为可能是有参数过来
    if(!s){
      if(SchoolScreem&&SchoolScreem.value){
        console.log(formInline.value , Twostab.value,'11111111111111111111111'); 
        SchoolScreem.value.reset2();   
      } 
    }
    if(!getone){
      getdata();
    }
     
    
  }

  // getMenu();
}
function screen() {
  //学校筛选显示
  SchoolScreem.value.showPopup = true;
}
function rests() {
  // 数据资源重置 
  // formInline.value = { ...formInline.value, ...Twostab.value }; //重置基础分页资源数据资源
  formInline.value = { ...Twostab.value }; //重置基础分页资源数据资源 
  tableData.value = [];
  hidesele();
  if (!Trees) {
    isends.value = false;
    // Trees.value.isEnd = false;
    Trees.value.isLoading = false;
  }
}
function getdata() {
  // 获取基础数据 使用参数判断是学校数据获取还是督课数据获取
  // if (tabobjs.value.load == "school") shoolData();
  // else onlineData();

  shoolData();
}
function getdel() {
  // 督课和学校删除
  let dels = is_online() ? timetableDel : schoolDel;
  dels({ ids: ids.value }).then((res) => {
    if (res.code == 1) {
      Message.success({
        content: "删除成功",
        placement: "top",
      });
      rests();
      getdata();
    }
  });
}
function shoolData() {
  // 学校数据获取
  console.log(tabobjs,'----------测试')
  let loadObj = tabobjs.value.loadObj ? tabobjs.value.loadObj : {};
  let objs = { ...formInline.value, ...loadObj }; //基础数据获取
  // true督课接口 false学校接口
  let listapi = is_online() ? timetableList : schoolList;
  if (is_online()) {
    // 督课
    let userinforefs = JSON.parse(getStorage("userinfo"));
    //  线上工作
    if (authority([5])) objs.zxguser_id = userinforefs.id;
    // 在地工作
    if (authority([4])) objs.user_id = userinforefs.id;
  }
 
  listapi(objs).then((res) => {
    // this.loadingPage = false;
    if (res.code == 1) {
      console.log(res, "---------res");
      if(res.data.current_page==1){
        console.log("111111")
        tableData.value = res.data.data;
      } 
      else{
        console.log("222222222")

        tableData.value = [...tableData.value, ...res.data.data];
      }
      
      // // 将列表数据转换为树形数据
      // this.tableData = XEUtils.toArrayTree(res.data.data, { parentKey: 'parent', strict: false })
      // if (
      //   tableData.value.length == res.data.total ||
      //   tableData.value.length >= 10
      // )
      //   isends.value = true;

      // if (tableData.value.length < 10) isends.value = false;
      if (Trees.value) {
        Trees.value.total = res.data.total;
        Trees.value.length = tableData.value.length; 
      }
      formInline.value.page = res.data.current_page;
      formInline.value.per_page = res.data.per_page;
      formInline.value.total = res.data.total;
      if (res.data.user) {
        user.value = res.data.user;
      } else {
        user.value = null;
      }

    }
  });
  console.log("学校数据获取");
}
function onlineData() {
  // 督课数据获取
  console.log("督课数据获取");
}
// caicountOpen();

function handleScroll() {
  // 触底加载接受
  console.log("触底加载接收");
  if (tableData.value.length == formInline.value.total) return;
  formInline.value.page = Number(formInline.value.page) + 1;
  getdata();
}

function submitForm(vaObj) {
  // 筛选提交
  rests(); //数据资源重置
  formInline.value = { ...formInline.value, ...vaObj };
  tableData.value = [];
  getdata();
}
function resetscreem() {
  // 筛选重置
  formInline.value = {...Twostab.value};
  tableData.value = [];
  getdata();
}

function addshool() {
  // 学校新增显示
  AddShool_rows.value.showPopup = true;
}

function addForm(obj) {
  // 学校新增方法
  let param = is_online() ? {} : {
    status: 1,
    is_status: 1,
  };
  param = { ...obj, ...param }; //数据新增
  let addapis = is_online() ? timetableAdd : schoolAdd;
  addapis(param)
    .then((res) => {
      if (res.code == 1) {
        AddShool_rows.value.showPopup = false;
        Message.success(res.msg);

        rests(); //数据资源重置
        getdata();
      } else {
        Message.warning(res.msg);
      }
    })
    .catch((err) => {
      // showMessage('warning','数据报错');
      Message.warning("数据报错");
    });
}

const handleSelectAllClick = (e) => {
  // 点击取消全选
  if (!selectAll.value && showViewList.value) {
    // 全选操作   --点击 只能做取消
    showViewList.value.forEach((item) => {
      item.select = false; //全选或者取消全选
      item.inspect(); //全选和反选
    });
  }
};
const handleSelectAll = (e) => {
  // 全选操作   --点击 只能选择
  if (e) {
    showViewList.value.forEach((item) => {
      item.select = true; //全选或者取消全选
      item.inspect(); //全选和反选
    });
  }
};

function inspect(e, id) {
  // 添加和删除id
  let index = ids.value.indexOf(id);
  if (index !== -1 && !e) {
    selectAll.value = false;
    ids.value.splice(index, 1);
  }
  if (index == -1 && e) {
    ids.value.push(id);
    if (ids.value.length == tableData.value.length) {
      selectAll.value = true;
    }
  }
}

// 删除
function handleDelete(obj) {
  if (obj && obj.id) {
    // 单个数据赋值
    ids.value = [];
    ids.value.push(obj.id);
  }
  // 批量删除
  console.log(ids.value.length, ids.value[0]);
  if (ids.value.length == 0 || !ids.value[0]) {
    Message.warning("请选择要删除的数据");
    return;
  }

  $dialog.confirm({
    title: "删除",
    content: `删除${selectAll.value && ids.value.length == tableData.value.length
        ? "全部"
        : ids.value.length + "条"
      }数据，是否确认删除！！！！`,
    confirmBtn: "确认",
    cancelBtn: "取消",
    onConfirm: () => {
      getdel();
    },
  });
}
const onConfirm = () => {
  console.log("dialog:confirm");
};
const onCancel = () => {
  wentixs.value = false;
};
// 外出批量
function handleOut(obj) {
  if (obj && obj.id) {
    // 单个数据赋值
    ids.value = [];
    ids.value.push(obj.id);
  }
  $dialog.confirm({
    title: `外出确认`,
    content: `选择${selectAll.value && ids.value.length == tableData.value.length
        ? "全部"
        : ids.value.length + "项"
      }数据外出？`,
    confirmBtn: "确认",
    cancelBtn: "取消",
    onConfirm: () => {
      let objse = { ids: ids.value };
      return schewaichu(objse).then((res) => {
        if (res.code == 1) {
          Message.success(res.msg);
          rests();
          getdata();
        }
      });
    },
  });
}
// 其他批量操作 核校批量
function openOkAll(obj, title, nub, top_shows = true) {
  // 批量 是3的话就是线上区域负责人的排课操作
  let openoks = !authority([3]) ? statuss : scheduling;
  if (obj && obj.id) {
    // 单个数据赋值
    ids.value = [];
    ids.value.push(obj.id);
  }
  if (top_shows) {

    // 批量删除
    console.log(ids.value.length, ids.value[0]);
    if (ids.value.length == 0 || !ids.value[0]) {
      Message.warning(`请选择要${title}确认的列表`);
      return;
    }

    $dialog.confirm({
      title: `${title}确认`,
      content: `选择${selectAll.value && ids.value.length == tableData.value.length
          ? "全部"
          : ids.value.length + "条"
        }数据，${title}确认？`,
      confirmBtn: "确认",
      cancelBtn: "取消",
      onConfirm: () => {
        let objse = { ids: ids.value };
        if (!authority([3])) objse.status = nub;
        return openoks(objse).then((res) => {
          if (res.code == 1) {
            Message.success({
              content: `${title}成功！！！`,
              placement: "top",
            });
            rests();
            getdata();
          }
        });
      },
    });
  } else {
    let objse = { ids: ids.value };
    if (!authority([3])) objse.status = nub;
    return openoks(objse).then((res) => {
      if (res.code == 1) {
        Message.success({
          content: `${title}成功！！！`,
          placement: "top",
        });
        rests();
        getdata();
      }
    });
  }
}

function handlewent(row) {
  let vm = this;
  ElMessageBox.prompt("请输入问题校原因", "问题校", {
    modalClass: "tanchuangshim",
    cancelButtonClass: "el-button el-button--success is-plain", //取消
    confirmButtonClass: "el-button--success", //确定
    showClose: false,
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    inputPattern: /.+/,
    inputErrorMessage: "请输入问题校原因",
  }).then(({ value }) => {
    return schoolUpdate({
      wenti_remark: value,
      id: row.id,
      status: 5,
    }).then((res) => {
      Message.success({
        content: res.msg,
        placement: "top",
      });
      rests();
      getdata();
    });
  });
}
function resttye(obj) {
  if (obj && obj.id) {
    // 单个数据赋值
    ids.value = [];
    ids.value.push(obj.id);
  }
  // 批量删除
  console.log(ids.value.length, ids.value[0]);
  if (ids.value.length == 0 || !ids.value[0]) {
    Message.warning("请选择要重置的数据");
    return;
  }

  $dialog.confirm({
    title: "重置",
    content: `重置${selectAll.value && ids.value.length == tableData.value.length
        ? "全部"
        : ids.value.length + "条"
      }数据，是否确认重置状态！！！！`,
    confirmBtn: "确认",
    cancelBtn: "取消",
    onConfirm: () => {
      return statuss({ ids: ids.value, status: 1 }).then((res) => {
        if (res.code == 1) {
          Message.success({
            content: "重置成功",
            placement: "top",
          });
          rests();
          getdata();
        }
      });
    },
  });
}
// 学校编辑 点击显示
function editShools(row) {
  console.log(row, "--------编辑数据");
  AddShool_rows.value.editupdata(row); //数据编辑
}
// 核校确认
function editShoolshx(row) {
  AddShool_rows.value.editupdata(row, "核校"); //数据编辑
}
// 编辑完的数据返回 编辑接口接入
function endForm(obj) {
  // 学校编辑
  console.log(obj, "----------督课编辑");
  let updataApi = is_online() ? timetableUpdate : schoolUpdate;
  updataApi(obj).then((res) => {
    if (res.code == 1) {
      console.log(res, "----------学校编辑");
      Message.success(res.msg);
      AddShool_rows.value.showPopup = false;
      let index = tableData.value.findIndex((item) => item.id == obj.id);
      // 赋值数据 新数据覆盖旧数据
      tableData.value[index] = obj;

      if (authority([4]) && selse.value == 2) {
        $dialog.confirm({
          title: "核校确认",
          content: `更改成功,是否进行核校确认？`,
          confirmBtn: "确认",
          cancelBtn: "取消",
          onConfirm: () => {
            // obj.status = 2;
            openOkAll(obj, "核校", 2, false);
          },
          onClose: () => {
            return;
          },
        });
      }
    } else {
      Message.error(res.msg || "失败");
    }
  });
}
const TodikendForm = (obj) => {
  // 转代课
  updatedaike(obj).then((res) => {
    if (res.code == 1) {
      Message.success(res.msg);
      dikzjs.value.reset();
    } else {
      Message.error(res.msg || "失败");
    }
  });
}
const TodukendForm = (obj) => {
  // 转督课
  updateduke(obj).then((res) => {
    if (res.code == 1) {
      Message.success(res.msg);
      dukzjs.value.reset();
    } else {
      Message.error(res.msg || "失败");
    }
  });
}
function schoolUpdateTs() { }
getMenu();
console.log(selse, "----------selse");
// console.log(getAllList.value[0].id,'--------getAllList.value[0].id')
// selseTab(getAllList.value[0].id);
// getdata();//数据获取
</script>

<style lang="scss" scoped>
.School_boxs {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tablistShows {
  padding: 0 10px;
}

.top_shows {
  display: flex;
  justify-content: end;
  padding: 5px 10px;
  box-sizing: border-box;
}
</style>
